package edu.ncsu.csc.itrust.http;

import com.meterware.httpunit.WebConversation;
import com.meterware.httpunit.WebResponse;

/**
 * Bug #4 HW2P2 
 * @author stbowen & pjfinega
 *
 */
public class MessageReadUnreadTest extends iTrustHTTPTest {

	/**
     * Clear and setup database for independent testing
     */
    protected void setUp() throws Exception{
        super.setUp();
        gen.clearAllTables();
        gen.standardData();
    }
    
    public void testMessagesRegisterAsRead() throws Exception{
    	
    	setUp();
    	
    	//Login as Random Person and navigate to message
    	WebConversation wc = login("2", "pw");
    	WebResponse wr = wc.getCurrentPage();
    	wr = wr.getLinkWith("1").click();
    	wr = wr.getLinkWith("Read").click();
    	wr = wr.getLinkWith("Home").click();
    	
    	//Check that it was read, if there isn't a "No" hyperlink then we succeeded.
    	assertFalse( wr.getLinkWith("No") == null );
    	
    }
	
}
